package org.jackysoft.entity;

import java.util.Collection;

import org.jackysoft.annotations.Id;
import org.jackysoft.entity.base.AbstractNoIdEntity;

import com.google.common.collect.Lists;



public class SecurityRole extends AbstractNoIdEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6202744855301590933L;
	private String name;
	private String description;
	private SecurityRole parent;
	private Collection<TreeNode> treeNode = Lists.newArrayList();
	private String  desktop;
	private Integer priority = 0;
	private boolean enabled = true;

	public SecurityRole() {
	}

	

	public SecurityRole(String name, String description) {
		this.name = name;
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	
	@Id	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null || !(obj instanceof SecurityRole))
			return false;
		SecurityRole o = (SecurityRole) obj;
		if (o.getName() == null && this.getName() == null)
			return false;
		return (o.getName().equals(this.getName()));

	}

	
	public SecurityRole getParent() {
		return parent;
	}

	public void setParent(SecurityRole parent) {
		this.parent = parent;
	}

	public void setTreeNode(Collection<TreeNode> treeNode) {
		this.treeNode = treeNode;
	}

	public Collection<TreeNode> getTreeNode() {
		return treeNode;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	/**
	 * 标识角色优先级
	 * */
	public Integer getPriority() {
		return priority;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}



	public String getDesktop() {
		return desktop;
	}



	public void setDesktop(String desktop) {
		this.desktop = desktop;
	}

}
